package portio

import _ "unsafe"

//go:linkname inb inb
func inb(port uint16) uint8

//go:linkname outb outb
func outb(port uint16, value uint8)

//go:linkname inw inw
func inw(port uint16) uint16

//go:linkname outw outw
func outw(port uint16, value uint16)

//go:linkname inl inl
func inl(port uint16) uint32

//go:linkname outl outl
func outl(port uint16, value uint32)

// Inb reads a byte from the specified I/O port.
func Inb(port uint16) uint8 { return inb(port) }

// Outb writes a byte to the specified I/O port.
func Outb(port uint16, value uint8) { outb(port, value) }

// Inw reads a 16-bit word from the specified I/O port.
func Inw(port uint16) uint16 { return inw(port) }

// Outw writes a 16-bit word to the specified I/O port.
func Outw(port uint16, value uint16) { outw(port, value) }

// Inl reads a 32-bit dword from the specified I/O port.
func Inl(port uint16) uint32 { return inl(port) }

// Outl writes a 32-bit dword to the specified I/O port.
func Outl(port uint16, value uint32) { outl(port, value) }